import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class demo1 {

    public static void main(String[] args) {
        List<User> list = new ArrayList();
        User user = new User(new BigDecimal(100));
        User user1 = new User(new BigDecimal(200));
        list.add(user);
        list.add(user1);


        BigDecimal bigDecimal = list.stream().map(User::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
        System.out.println(bigDecimal);

    }


}

@Data
class User {
    private BigDecimal money;

    public User(BigDecimal money) {
        this.money = money;
    }


    public BigDecimal getMoney() {
        return this.money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

}
